import type { PageData, PageDto, PutDto, PutRes } from "~/rest";

import { type Gateway, getGateway } from "@/droplet-bus/core.define";

import { app_gateway } from "@/river-market/core.local";
import type { MarketAccount, MarketOrder } from "@/river-market/schema.order";

export const MarketAccountGateway: Gateway = getGateway(app_gateway, "river_market_account");
export interface MarketAccountInterfaceWithDerive<T> {
  /** 查询账户余额 */
  get(dto: T): Promise<PutRes<MarketAccount>>;
  /** 刷新账户余额 */
  patch(dto: T): Promise<PutRes<MarketAccount>>;
}

export const MarketOrderGateway: Gateway = getGateway(app_gateway, "river_market_order");
export type getMarketOrderDto = PageDto<MarketOrder>;
export type putMarketOrderDto = PutDto<MarketOrder>;

export interface MarketOrderInterfaceWithDerive<T> {
  get(dto: T & getMarketOrderDto): Promise<PageData<MarketOrder>>;
  put(dto: T & putMarketOrderDto): Promise<PutRes<MarketOrder>>;
}
